package server.com.acme;

import server.com.acme.bankapp.domain.bank.BankServer;
import server.com.acme.bankapp.service.bank.BankService;

public class BankApplication {
	private final static String serializeFile = "test/serialFile.txt";
	private final static String loadfeed = "-loadfeed";
	private final static String loadbank = "-loadbank";
	private final static String serv = "-server";
	private final static String errCommandLine = "Wrong command line key";

	public static void main(String[] args) {
		BankService bankService = new BankService(serializeFile);
		BankServer server = new BankServer(bankService);

		if (args.length == 0) {
			return;
		}

		if (args[0].equals(loadfeed)) {
			bankService.loader.read(args[1], bankService);
		} else if (args[0].equals(loadbank)) {
			bankService.readBank();
		} else {
			System.out.println(errCommandLine);
			return;
		}

		if (args.length == 3) {
			if (args[2].equals(serv)) {
				server.startServer(bankService.bank);
			}
		}

	}

}
